package com.lkk.testcase;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lkk.data.ExcelDataEntity;
import com.lkk.data.ExcelDataException;
import com.lkk.data.Log;
import com.lkk.interaction.RestfulClient;
import com.lkk.util.CommonUtil;
import com.lkk.util.Constant;
import com.lkk.util.EntityListUtil;
import com.lkk.util.Red_Excel;

public class apiTest2 extends CaseSuper{
	//指定用例编号
	private String caseNum = "xxx-2";
	
	@BeforeClass
	public void startCaseClass() {
		Log.startTestCase();
	}
	
	@BeforeMethod
	public void startCase() {
		caseNumList.add(caseNum);
	}
	
	@Test(priority = 2)
	public void case2(){
		getExcelDataEntity(caseNumList.get(0));
		//获取参数
		getParam();
		//设置userId
		body.put("userId", CommonUtil.userId);
		//发送请求
		getResponse(caseNum);
		
		String errorMsg = responseBody.getString("errorMsg");
		Assert.assertEquals(errorMsg,assertions.get("errorMsg"));
		Assert.assertEquals(Integer.toString(responseCode),status);
	}

	@AfterMethod
	public void endCase() {
		Log.endTestCase();
	}
	
}
